package com.fdd.op.demo;

import com.fdd.op.sdk.ApiException;
import com.fdd.op.sdk.DefaultFddClient;
import com.fdd.op.sdk.constants.Constants;
import com.fdd.op.sdk.internal.token.FddTokenStore;
import com.fdd.op.sdk.internal.token.stroe.CacheTokenStoreImpl;
import com.fdd.op.sdk.internal.util.json.JSONWriter;
import com.fdd.op.sdk.request.api.account.GetAccountRequest;
import com.fdd.op.sdk.response.api.account.GetAccountResponse;

/**
 * 获取用户详情
 *
 * @version 2.0.0
 * @author: Fadada
 * @date: 2022/6/1
 */
public class GetAccountApi {
    private static String serverUrl = "http://10.21.8.20:37801";
    private static final String appId = "486478";
    private static final String appKey = "xguUMVFnDzqJgfVEDnLW16yE2mxVL2Fp";

    public static void main(String[] args) throws ApiException {
        JSONWriter writer = new JSONWriter(false, true);
        FddTokenStore tokenStore = new CacheTokenStoreImpl();
        DefaultFddClient fddClient = new DefaultFddClient(serverUrl, appId, appKey, Constants.AUTH_SIGN, 1000, 30000);
        fddClient.tokenStore(tokenStore);
        GetAccountRequest request = new GetAccountRequest();
        request.setAccountId("1683413560658190337");
        //request.putOtherTextParam("accountId", "1519567956789477378");
        //fddClient.execute(request);
        GetAccountResponse response = fddClient.execute(request);
        if (response != null && response.getData() != null) {
            System.out.println(writer.write(response.getData()));
        }
        response = fddClient.execute(request);
        if (response != null && response.getData() != null) {
            System.out.println(writer.write(response.getData()));
        }
    }
}
